
/**
 * @author Fabian Kretzschmar
 * @version 1.0
 */
public class Stack
{
    // Bezugsobjekte
    private Node head;

    // Attribute

    // Konstruktor
    public Stack()
    {

    }

    // Dienste
    public boolean isEmpty() 
    {
        return this.head == null;
    }

    public Object top()
    {
        if (this.isEmpty())
            return null;
        else
            return head.content();
    }
    
    public void pop()
    {
        if (this.isEmpty()) return;
        head = head.next();
    }
    
    public void push(Object pContent)
    {
        head = new Node(pContent,this.head);
    }
}
